/**
 * Copyright (C) 2011  Robin Dietrich, Nils Kenneweg, Leonard Stutz
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 * 
 **/ 

#ifndef BLOCKMANAGER_HPP
#define	BLOCKMANAGER_HPP

#include "tpl/singleton.hpp"
#include "tpl/factory.hpp"
#include "block.hpp"

//include available blocks
#include "blocks/1_stone.hpp"
#include "blocks/2_wood.hpp"
#include "blocks/3_dirt.hpp"
#include "blocks/4_grass.hpp"

namespace minecraft {
    /** shortcut to make factory adding easier */
    template <class dType> class blockCreator : public dCreator<dType, block> {};
    
    /** dated block factory */
    class blockManager : public datedFactory<block, b_type> {
        public:
            /** block manager constructor */
            blockManager() {
                //add all possible blocks here
                this->add(1, new blockCreator<stone>);
                this->add(2, new blockCreator<wood>);
                this->add(3, new blockCreator<dirt>);
                this->add(4, new blockCreator<grass>);
            }
            /** destructor */
            virtual ~blockManager() {}
    };
    
    /** typedef for singleton access to blockManager */
    typedef Singleton<blockManager> sBlockManager;
}

#endif	/* BLOCKMANAGER_HPP */

